home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gs261src.zip / GXPATH.H < prev    next >
C/C++ Source or Header  |  1993-05-13  |  4KB  |  102 lines

  1. /* Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gxpath.h */
  20. /* Lower-level path routines for Ghostscript library */
  21. /* Requires gxfixed.h */
  22.  
  23. /* The routines and types in this interface use */
  24. /* device, rather than user, coordinates, and fixed-point, */
  25. /* rather than floating, representation. */
  26.  
  27. /* Opaque type for a path */
  28. typedef struct gx_path_s gx_path;
  29. extern const uint gs_path_sizeof;
  30.  
  31. /* Opaque type for a path enumerator */
  32. typedef struct gx_path_enum_s gx_path_enum;
  33. extern const uint gx_path_enum_sizeof;
  34.  
  35. /* Define the two insideness rules */
  36. #define gx_rule_winding_number (-1)
  37. #define gx_rule_even_odd 1
  38.  
  39. /* Debugging routines */
  40. #ifdef DEBUG
  41. extern    void    gx_path_print(P1(const gx_path *));
  42. #endif
  43.  
  44. /* Path constructors. */
  45. extern    void    gx_path_init(P2(gx_path *, const gs_memory_procs *)),
  46.         gx_path_reset(P1(gx_path *)),
  47.         gx_path_release(P1(gx_path *)),
  48.         gx_path_share(P1(gx_path *));
  49. extern    int    gx_path_add_point(P3(gx_path *, fixed, fixed)),
  50.         gx_path_add_relative_point(P3(gx_path *, fixed, fixed)),
  51.         gx_path_add_line(P3(gx_path *, fixed, fixed)),
  52.         gx_path_add_rectangle(P5(gx_path *, fixed, fixed, fixed, fixed)),
  53.         gx_path_add_pgram(P7(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed)),
  54.         gx_path_add_curve(P7(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed)),
  55.         gx_path_add_flattened_curve(P8(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, floatp)),
  56.         gx_path_add_arc(P8(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, floatp)),
  57.         gx_path_add_path(P2(gx_path *, gx_path *)),
  58.         gx_path_close_subpath(P1(gx_path *));
  59. /* The last argument to gx_path_add_arc is a fraction for computing */
  60. /* the curve parameters.  Here is the correct value for quarter-circles. */
  61. /* (stroke uses this to draw round caps and joins.) */
  62. #define quarter_arc_fraction 0.552285
  63.  
  64. /* Path accessors */
  65.  
  66. extern    int    gx_path_current_point(P2(const gx_path *, gs_fixed_point *)),
  67.         gx_path_bbox(P2(gx_path *, gs_fixed_rect *)),
  68.         gx_path_has_curves(P1(const gx_path *)),
  69.         gx_path_is_void(P1(const gx_path *)),
  70.         gx_path_is_rectangle(P2(const gx_path *, gs_fixed_rect *));
  71. /* Inline versions of the above */
  72. #define gx_path_is_void_inline(ppath) ((ppath)->first_subpath == 0)
  73. #define gx_path_has_curves_inline(ppath) ((ppath)->curve_count != 0)
  74.  
  75. /* Path transformers */
  76.  
  77. extern    int    gx_path_copy(P3(const gx_path * /*old*/, gx_path * /*new*/, int /*init*/)),
  78.         gx_path_flatten(P4(const gx_path * /*old*/, gx_path * /*new*/, floatp, int)),
  79.         gx_path_copy_reversed(P3(const gx_path * /*old*/, gx_path * /*new*/, int /*init*/)),
  80.         gx_path_translate(P3(gx_path *, fixed, fixed)),
  81.         gx_path_scale(P3(gx_path *, floatp, floatp));
  82.  
  83. /* ------ Clipping paths ------ */
  84.  
  85. /* Opaque type for a path */
  86. typedef struct gx_clip_path_s gx_clip_path;
  87. extern const uint gs_clip_path_sizeof;
  88.  
  89. extern    int    gx_clip_to_rectangle(P2(gs_state *, gs_fixed_rect *)),
  90.         gx_clip_to_path(P1(gs_state *)),
  91.         gx_cpath_init(P2(gx_clip_path *, const gs_memory_procs *)),
  92.         gx_cpath_from_rectangle(P3(gx_clip_path *, gs_fixed_rect *, const gs_memory_procs *)),
  93.         gx_cpath_intersect(P4(gs_state *, gx_clip_path *, gx_path *, int));
  94. extern    void    gx_cpath_release(P1(gx_clip_path *)),
  95.         gx_cpath_share(P1(gx_clip_path *));
  96. extern    int    gx_cpath_path(P2(gx_clip_path *, gx_path *)),
  97.         gx_cpath_box_for_check(P2(const gx_clip_path *, gs_fixed_rect *)),
  98.         gx_cpath_includes_rectangle(P5(const gx_clip_path *, fixed, fixed, fixed, fixed));
  99.  
  100. /* Opaque type for a clip list. */
  101. typedef struct gx_clip_list_s gx_clip_list;
  102.